package com.neuedu.yyzx.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.yyzx.common.CommonResult;
import com.neuedu.yyzx.entity.Maintain;
import com.neuedu.yyzx.service.IMaintainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 基础数据维护  前端控制器
 * </p>
 *
 * @author dya
 * @since 2021-04-27
 */
@RestController
@RequestMapping("//maintain")
public class MaintainController {

    @Autowired
    IMaintainService maintainService;

    @RequestMapping("/list")
    CommonResult list(Page page, Maintain maintain){
        QueryWrapper queryWrapper=new QueryWrapper();
        return CommonResult.success(maintainService.page(page,queryWrapper));
    }

    @RequestMapping("/add")
    CommonResult add(Maintain maintain){
        return CommonResult.success(maintainService.saveOrUpdate(maintain));
    }


    @RequestMapping("/getById")
    CommonResult getById(Integer dataId){
        return CommonResult.success(maintainService.getById(dataId));
    }

    @RequestMapping("/del")
    CommonResult del(Integer dataId){
        return CommonResult.success(maintainService.removeById(dataId));
    }



}
